/**
 * Created by abdulazizalonizi on 8/8/17.
 */
public class Sphere {
    private double radius, xCenter, yCenter ;

    public Sphere(double radius, double xCenter, double yCenter)
    {
        if(radius <0 )
            throw new IllegalArgumentException("Error : radius less that Zer0 !");
        this.radius = radius;
        this.xCenter = xCenter;
        this.yCenter = yCenter;

    }

    public String toString()
    {
     return "Radius :"+this.radius+" ,Xcenter :"+this.xCenter+" ,Ycenter :"+this.yCenter;
    }

    public boolean equals(Object other)
    {
        if (other instanceof Sphere)
        {
            Sphere otherSphere = (Sphere) other ;
            if (otherSphere.radius == this.radius & otherSphere.yCenter == this.yCenter & otherSphere.xCenter == this.xCenter)
            {
                return true ;
            }
            else
                return false ;
        }else
        {
            throw new IllegalArgumentException("Error :not same type argument!");
        }
    }

    public Sphere(Sphere other)
    {
        this.radius = other.radius ;
        this.xCenter = other.xCenter;
        this.yCenter = other.yCenter ;


    }

    public double getxCenter()
    {
        return this.xCenter ;
    }
    public double getRadius()
    {
        return this.radius ;
    }
    public double getyCenter()
    {
        return this.yCenter ;
    }


    public void setRadius (double radius)
    {
        if (radius < 0 )
            throw new IllegalArgumentException("Error: Dimension <= 0");

        this.radius = radius;
    }
    public void setyCenter (double yCenter)
    {


        this.yCenter = yCenter;
    }
    public void setxCenter (double xCenter)
    {


        this.xCenter = xCenter;
    }

    public double calculateVolume ()
    {
        return (4/3.0)*Math.PI*Math.pow(this.radius,3);
    }


    public double calculateSurfaceArea ()
    {
        return 4*Math.PI*Math.pow(this.radius,2);
    }


}
